<?php
session_start();
if(!isset($_SESSION['uid']))
 	{?>
		<script type="text/javascript">
			window.location="error.php";
		</script>
	<?php 
 	}else 		
 		{
			require_once 'dataBaseConnectivityFile.php';
			
			$CONDITION=$_REQUEST["condition"];
			$TITLE=$_REQUEST["title"];
			$MAKE=$_REQUEST["make"];
			$BODY_STYLE=$_REQUEST["body_style"];
			$START_YEAR=$_REQUEST["start_year"];
			$END_YEAR=$_REQUEST["end_year"];
			$MILEAGE=$_REQUEST["mileage"];
			$TRANSMISSION=$_REQUEST["transmission"];
			$DRIVE_TRAIN=$_REQUEST["drivetrain"];
			$EXTERIOR_COLOR=$_REQUEST["exterior_color"];
			$INTERIOR_COLOR=$_REQUEST["interior_color"];
			$FUEL_TYPE=$_REQUEST["fuel_type"];
			$CITY_MILES_PER_GALLON=$_REQUEST["city_miles"];
			$HIGHWAY_MILES_PER_GALLON=$_REQUEST["highway_miles"];
			$CAR_STATUS=$_REQUEST["status"];
			$PRICE=$_REQUEST["PRICE"];
			$CONTACT=$_REQUEST["contact"];
			$GET_STOCK_ID=$_REQUEST['stock_id'];
			$ENGINE=$_REQUEST['engine'];
			$MODEL_NUMBER=$_REQUEST['model_number'];
			$VIN=$_REQUEST['vin'];			
			
			$sql_query="UPDATE stock SET TITLE='".$TITLE."', `CONDITION`='".$CONDITION."', MAKE='".$MAKE."', BODY_STYLE='".$BODY_STYLE."',
			START_YEAR='".$START_YEAR."', END_YEAR='".$END_YEAR."', MILEAGE='".$MILEAGE."', TRANSMISSION='".$TRANSMISSION."', 
			DRIVE_TRAIN='".$DRIVE_TRAIN."', EXTERIOR_COLOR='".$EXTERIOR_COLOR."', INTERIOR_COLOR='".$INTERIOR_COLOR."', 
			FUEL_TYPE='".$FUEL_TYPE."', CITY_MILES_PER_GALLON='".$CITY_MILES_PER_GALLON."', 
			HIGHWAY_MILES_PER_GALLON='".$HIGHWAY_MILES_PER_GALLON."', `STATUS`='".$CAR_STATUS."', PRICE='".$PRICE."', 
			CONTACT_NO='".$CONTACT."', MODIFIED_DATE=NOW(), `ENGINE`='".$ENGINE."', MODEL_NUMBER='".$MODEL_NUMBER."',	VIN='".$VIN."' WHERE STOCK_ID=".$GET_STOCK_ID."	";
			if(!mysql_query($sql_query,$con))
	                {
		                   die ("ERROR ".mysql_error());
	                }else
	                {?>
		                        <script type="text/javascript">
		                            alert("Basic Vehicle Information Updated");
		                            window.location="viewDetails.php?stock_id="+<?php echo $GET_STOCK_ID?>;
		                        </script>		    				            	
	                <?php 
	                }			
 				}
 		?>